package dockyin.action.pattern.state;

public class Context {
    private State state;

    public Context(State state) {
        this.state = state;
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public void operate() {
        switch (state.getState()) {
            case 1:
                state.method_1();
                break;
            case 2:
                state.method_2();
                break;
            default:
                System.out.println("Context in unknown state. No action invoked.");
        }
    }
}
